#include<bits/stdc++.h>
using namespace std;

typedef long long int ll;

int main()
{
	ll res = 1, sum = 0;
	
	for(ll i=1; i<=202320232023; ++i)
	{
		if(res%1000000000 == 0)
			break;
		res %= 1000000000;
		res = i * res;
		sum += res;
	}
	cout << sum%1000000000 << endl;
	
	
	return 0;
}

